package com.qcby.controller;

import com.qcby.entity.InformationOverview.CheckingScriptCount;
import com.qcby.entity.InformationOverview.ShopTag;
import com.qcby.entity.InformationOverview.TOP5Chart;
import com.qcby.entity.InformationOverview.TOPChartDTO;
import com.qcby.entity.Result;
import com.qcby.entity.Shop;
import com.qcby.service.InformationOverviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/informationOverview")
@RestController
public class InformationOverviewController {
    @Autowired
    private InformationOverviewService informationOverviewService;
//    用户数量
    @RequestMapping("/userCount")
    public Result GetUserCount(){
        Integer count = informationOverviewService.userCount();
        return Result.success(count);
    }
//    店铺数量
    @RequestMapping("/shopCount")
    public Result GetShopCount(){
        Integer count = informationOverviewService.shopCount();
        return Result.success(count);
    }
//    打卡记录总数
    @RequestMapping("/checkingsCount")
    public Result GetCheckingsCount(){
        Integer count = informationOverviewService.checkingsCount();
        return Result.success(count);
    }
    @RequestMapping("/auditCount")
    @ResponseBody
    public Result GetAuditCount(){
        Integer count = informationOverviewService.auditCount();
        return Result.success(count);
    }
    @RequestMapping("/scriptCount")
    @ResponseBody
    public Result GetScriptCount(){
        Integer count = informationOverviewService.scriptCount();
        return Result.success(count);
    }
    @RequestMapping("/tagCount")
    @ResponseBody
    public Result GettagCount(){
        Integer count = informationOverviewService.tagCount();
        return Result.success(count);
    }
//    TOP5商店
    @RequestMapping("/TOP5Chart")
    @ResponseBody
    public Result GetTOP5Chart(){
        TOPChartDTO topChartDTO = informationOverviewService.TOP5Chart();
        return Result.success(topChartDTO);
    }
    @RequestMapping("/ShopTag")
    @ResponseBody
    public Result GetTShopTag(){
        List<ShopTag> list = informationOverviewService.ShopTag();
        return Result.success(list);
    }
    @RequestMapping("/CheckingScriptCount")
    @ResponseBody
    public Result CheckingScriptCount(){
        List<CheckingScriptCount> list = informationOverviewService.CheckingScriptCount();
        return Result.success(list);
    }
    @RequestMapping("/UserTOP5Count")
    public Result UserTOP5Count(){
        List<TOP5Chart> list = informationOverviewService.UserTOP5Count();
        return  Result.success(list);
    }
    @RequestMapping("/getAllShops")
    @ResponseBody
    public Result getAllShops(Double rating) {
        List<Shop> shops = informationOverviewService.getAllShops(rating);
        return Result.success(shops);
    }

}
